package com.jiazhong.异常;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Demo02 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        try {
            System.out.println("请输入两个数");
            Integer a=scanner.nextInt();
            Integer b=scanner.nextInt();
            Integer c=a/b;
        }
        catch (ArithmeticException e){
            System.out.println("算数异常");
            e.printStackTrace();
        }
        catch (InputMismatchException e){
            System.out.println("输入异常");
        }
        catch (NullPointerException e){
            System.out.println("空指针异常");
        }
        catch (Exception e){
            System.out.println("未知异常");
        }
        finally {
            System.out.println("不管异常是否都将执行");
        }
        System.out.println("程序结束");
    }
}
